home *** CD-ROM | disk | FTP | other *** search
- ;
- ; Prologue
- ;
- PROLOGUE
- ;
- ; Use MINLEN to set READNEXT to ignore null lines in the input
- ;
- MINLEN "1" "1"
- ;
- ; Skip the header lines
- ;
- ; Note that since we're in the PROLOGUE section, the first READNEXT
- ; actually reads the first line of the input file, since the prologue
- ; is run before any input lines have been read.
- ;
- READNEXT
- READNEXT
- READNEXT
- READNEXT
- READNEXT
- READNEXT
- READNEXT
- ;
- ; Output a report header. We could use the OUTHDG command to do
- ; this, but it's just as easy to use OUTEND in the PROLOGUE section.
- ;
- ; ----+----1----+----2----+----3----+----4 (Measuring scale)
- OUTEND |----------------------------------------
- OUTEND | WEEKLY SALES SUMMARY
- OUTEND |----------------------------------------
- OUTEND |
- OUTEND | DATE CRATES SOLD EARNINGS
- OUTEND |-------- ----------- ------------
- END
- ;
- ;-------------------------------------------------------------------------------
- ;
- ; Get the date and initialize the daily figures
- ;
- ; We did not have to initialize the accumulating weekly figures in the
- ; prologue, since an unassigned variable is set to null (""), which
- ; the calculation commands treat as zero.
- ;
- IGNORE $FLINE[11] = "-"
- DATE date "" $FLINE[14 15] $FLINE[17 18] "M ?d"
- PAD date "C" " " "8"
- SET soldtoday = "0"
- SET cashtoday = "0.00"
- ;
- ; Read in the day's data
- ;
- ; Beans
- ;
- CALC soldbeanwkly = soldbeanwkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashbeanwkly = cashbeanwkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Zucchinis
- ;
- READNEXT
- CALC soldzuccwkly = soldzuccwkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashzuccwkly = cashzuccwkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Tomatoes, Type 1
- ;
- READNEXT
- CALC soldtom1wkly = soldtom1wkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashtom1wkly = cashtom1wkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Tomatoes, Type 2
- ;
- READNEXT
- CALC soldtom2wkly = soldtom2wkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashtom2wkly = cashtom2wkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Corn
- ;
- READNEXT
- CALC soldcornwkly = soldcornwkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashcornwkly = cashcornwkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Lettuce
- ;
- READNEXT
- CALC soldlettwkly = soldlettwkly "+" $FLINE[50 58]
- CALC soldtoday = soldtoday "+" $FLINE[50 58]
- CALCREAL cash = $FLINE[50 58] "*" $FLINE[61 69] "2"
- CALCREAL cashlettwkly = cashlettwkly "+" cash "2"
- CALCREAL cashtoday = cashtoday "+" cash "2"
- ;
- ; Accumulate the total weekly figures
- ;
- CALC soldwkly = soldwkly "+" soldtoday
- CALCREAL cashwkly = cashwkly "+" cashtoday "2"
- ;
- ; Output the daily figures
- ;
- PAD soldtoday "L" " " "12"
- PAD cashtoday "L" " " "11"
- OUTEND |{date} {soldtoday} ${cashtoday}
- ;
- ;-------------------------------------------------------------------------------
- ;
- ; Epilogue
- ;
- ;
- EPILOGUE
- ;
- ; Format figures for output
- ;
- PAD soldwkly "L" " " "12"
- PAD cashwkly "L" " " "12"
- PAD soldbeanwkly "L" " " "12"
- PAD soldzuccwkly "L" " " "12"
- PAD soldtom1wkly "L" " " "12"
- PAD soldtom2wkly "L" " " "12"
- PAD soldcornwkly "L" " " "12"
- PAD soldlettwkly "L" " " "12"
- PAD cashbeanwkly "L" " " "12"
- PAD cashzuccwkly "L" " " "12"
- PAD cashtom1wkly "L" " " "12"
- PAD cashtom2wkly "L" " " "12"
- PAD cashcornwkly "L" " " "12"
- PAD cashlettwkly "L" " " "12"
- ;
- ; Calculate averages
- ;
- ; Note that we do not specify the number of decimal places
- ; for soldavg, so we will get a "floating point" answer.
- ;
- CALCREAL soldavg = soldwkly "/" "5"
- CALCREAL cashavg = cashwkly "/" "5" "2"
- PAD soldavg "L" " " "12"
- PAD cashavg "L" " " "12"
- ;
- ; Figure out best-selling and best-earning item
- ;
- CALC soldbest = soldbeanwkly "HIGHEST" soldzuccwkly
- IF soldbest #< soldtom1wkly THEN soldbest = soldtom1wkly
- IF soldbest #< soldtom2wkly THEN soldbest = soldtom2wkly
- IF soldbest #< soldcornwkly THEN soldbest = soldcornwkly
- IF soldbest #< soldlettwkly THEN soldbest = soldlettwkly
- PAD soldbest "L" " " "12"
-
- CALCREAL cashbest = cashbeanwkly "HIGHEST" cashzuccwkly "2"
- IF cashbest #< cashtom1wkly THEN cashbest = cashtom1wkly
- IF cashbest #< cashtom2wkly THEN cashbest = cashtom2wkly
- IF cashbest #< cashcornwkly THEN cashbest = cashcornwkly
- IF cashbest #< cashlettwkly THEN cashbest = cashlettwkly
- PAD cashbest "L" " " "12"
- ;
- ; Figure out worst-selling and worst-earning item
- ;
- CALC soldworst = soldbeanwkly "LOWEST" soldzuccwkly
- IF soldworst #> soldtom1wkly THEN soldworst = soldtom1wkly
- IF soldworst #> soldtom2wkly THEN soldworst = soldtom2wkly
- IF soldworst #> soldcornwkly THEN soldworst = soldcornwkly
- IF soldworst #> soldlettwkly THEN soldworst = soldlettwkly
- PAD soldworst "L" " " "12"
-
- CALCREAL cashworst = cashbeanwkly "LOWEST" cashzuccwkly "2"
- IF cashworst #> cashtom1wkly THEN cashworst = cashtom1wkly
- IF cashworst #> cashtom2wkly THEN cashworst = cashtom2wkly
- IF cashworst #> cashcornwkly THEN cashworst = cashcornwkly
- IF cashworst #> cashlettwkly THEN cashworst = cashlettwkly
- PAD cashworst "L" " " "12"
- ;
- ; Output a header (column scale shown below)
- ;
- ; ----+----1----+----2----+----3----+----4 (Measuring scale)
- OUTEND |
- OUTEND |----------------------------------------
- OUTEND | WEEKLY FIGURES
- OUTEND |----------------------------------------
- OUTEND |
- OUTEND |CRATES SOLD: Beans: {soldbeanwkly}
- OUTEND | Zucchini: {soldzuccwkly}
- OUTEND | Tomato Type 1: {soldtom1wkly}
- OUTEND | Tomato Type 2: {soldtom2wkly}
- OUTEND | Corn: {soldcornwkly}
- OUTEND | Lettuce: {soldlettwkly}
- OUTEND | -------------- ------------
- OUTEND | Weekly Total: {soldwkly}
- OUTEND | Daily Average: {soldavg}
- OUTEND | Best Volume: {soldbest}
- OUTEND | Worst Volume: {soldworst}
- OUTEND |
- OUTEND |EARNINGS: Beans: ${cashbeanwkly}
- OUTEND | Zucchini: ${cashzuccwkly}
- OUTEND | Tomato Type 1: ${cashtom1wkly}
- OUTEND | Tomato Type 2: ${cashtom2wkly}
- OUTEND | Corn: ${cashcornwkly}
- OUTEND | Lettuce: ${cashlettwkly}
- OUTEND | -------------- ------------
- OUTEND | Weekly Total: ${cashwkly}
- OUTEND | Daily Average: ${cashavg}
- OUTEND | Best Earning: ${cashbest}
- OUTEND | Worst Earning: ${cashworst}
- END
-